guardrail: prohibit the destructive-prepend one-liner (P0) + mandatory wc -l post-check - #1083
Merged
Merged
Conversation
CLAUDE.md In-Session Orchestration Discipline gains a P0 rule banning open(p, 'w').write(entry + open(p).read()) and every same-file truncate-while-reading shape (incl. 'sort f > f'), with the mandatory wc -l post-check after every ledger write. EPIPHANIES.md gains E-DESTRUCTIVE-PREPEND-TRUNCATES-BEFORE-READ-1 (prepended, append-only discipline observed: read-into-variable was NOT used here — the Edit tool was, which is read-anchored by construction). Provenance: the pattern destroyed 5876 lines of PR_ARC_INVENTORY.md in the #1081 hygiene commit; restored in #1082 (82679c3); census trap 10 already banked. This PR makes the prohibition canonical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCGhDYoQBXs3poaR7sFuqp
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_48fc72bb-f846-4763-a32c-93b1bcc4312f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the pattern that destroyed
PR_ARC_INVENTORY.mdin #1081 (restored in #1082) canonically prohibited, not just documented as a trap:CLAUDE.md§ In-Session Orchestration Discipline — new P0 rule:open(p, "w")truncates BEFORE the argument'sopen(p).read()runs; the read-back is empty and the file's history is gone. Prohibited in every form — any expression, statement, or shell pipeline that opens a file for writing while it still needs to read that same file (sort f > fis the same defect). Prepend = read into a variable → compose in memory → write, or use theEdittool (read-anchored by construction). Mandatory post-check after every board/ledger write:wc -l— an append-only file that got SHORTER is always a defect.EPIPHANIES.md— prependsE-DESTRUCTIVE-PREPEND-TRUNCATES-BEFORE-READ-1(FINDING + PROHIBITION, operator-directed), cross-referencing census trap 10 and restore PR board: restore PR_ARC_INVENTORY.md (5876 lines destroyed by #1081's destructive prepend) #1082, and sharpening the existing "Read before Write, always" P0: it applies WITHIN a single expression's evaluation order, not just across tool calls.Post-check (the rule, applied to this PR's own writes)
EPIPHANIES.md: 23279 → 23322 lines (longer, entry prepended viaEdit)CLAUDE.md: grew by the new rule blockGenerated by Claude Code